/*
 * Copyright (c) 2002-2006 by OpenSymphony
 * All rights reserved.
 */
package org.fordprefect.struts2jscalendarplugin.views.jsp.ui;

import com.opensymphony.xwork2.util.ValueStack;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ui.AbstractUITag;
import org.fordprefect.struts2jscalendarplugin.components.Head;

/**
 * @see Head
 */
public class HeadTag extends AbstractUITag {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String calendarcss;
    private String debug;
    
    //add language support by marshal.
    private String language;

    public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
        return new Head(stack, req, res);
    }

    protected void populateParams() {
        super.populateParams();
        if (calendarcss != null) {
        	((Head) component).setCalendarcss(calendarcss);
        }
        if (debug != null) {
        	((Head) component).setDebug(Boolean.valueOf(debug).booleanValue());
        }
        // add by marshal
        if (this.language != null) {
        	((Head) component).setLanguage((this.language));
        }
    }

    public String getCalendarcss() {
        return calendarcss;
    }

    public void setCalendarcss(String calendarcss) {
        this.calendarcss = calendarcss;
    }

    public void setDebug(String debug) {
        this.debug = debug;
    }
}
